<%@ page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ include file="/WEB-INF/jsp/common/include/taglibs.jsp"%>

<jsp:include page="/WEB-INF/common/menu/ADMIN_LEFT_MENU.html" flush="false"/>

<div class="span9" id="content">
	<!-- block -->
	<div class="block">
		<div class="navbar navbar-inner block-header">
			<div class="muted pull-left">상세조회</div>
		</div>
		<div class="block-content collapse in">
			<div class="span12">
				<form class="form-horizontal" action="./editProcess.do" method="post" id="frmSave">
					<input name="menu_seq" value="${param.menu_seq }" type="hidden" />
					<input name="bd_no" value="${map.bd_no}" type="hidden" />
					<fieldset>
						<div class="control-group">
							<label class="control-label" for="title">제목</label>
							<div class="controls">
								<input type="text" name="bd_title" class="span8" id="bd_title" value="${map.bd_title }">
							</div>
						</div>
						<div class="control-group">
							<label class="control-label" for="editor">내용</label>
							<div class="controls">
	                            <textarea id="editor" name="bd_content" style="height:300px;">${map.bd_content }</textarea>
							</div>
						</div>
						<div class="control-group">
							<label class="control-label" for="bd_email">이메일</label>
							<div class="controls">
								<input type="text" name="bd_email" class="span8" id="bd_email" value="${map.bd_email }">
							</div>
						</div>
						<div class="control-group">
							<label class="control-label" for="bd_pwd">비밀번호</label>
							<div class="controls">
								<input type="text" name="bd_pwd" class="span8" id="bd_pwd" value="${map.bd_pwd }">
							</div>
						</div>
						<div class="control-group">
							<label class="control-label" for="user_name">작성자명</label>
							<div class="controls">
								<input type="text" name="user_name" class="span8" id="user_name" value="${map.user_name }">
							</div>
						</div>
						<div class="control-group">
							<label class="control-label" for="phone">전화번호</label>
							<div class="controls">
								<input type="text" name="phone" class="span8" id="phone" value="${map.phone }">
							</div>
						</div>
						<div class="control-group">
							<label class="control-label" for="secret_yn">기타</label>
							<div class="controls">
								<label class="uniform">
								  <div class="checker"><span class=""><input class="uniform_on" type="checkbox" name="secret_yn" id="secret_yn" value="Y"></span></div>
									비밀글여부
								</label>
								<label class="uniform">
								  <div class="checker"><span class=""><input class="uniform_on" type="checkbox" name="notice_yn" id="notice_yn" value="Y"></span></div>
									공지글여부
								</label>
							</div>
						</div>
						<div class="control-group">
							<label class="control-label" for="file">첨부파일</label>
							<div class="controls">

<!-- 		fileHtml+="<label class=\"uniform _hwFiles\">"+ -->
<!-- 		"<input type='hidden' name='bdf_no' value=' '/>"+ -->
<!-- 		"<input type='hidden' name='upload' value='"+this.upload+"'/>"+ -->
<!-- 		"<input type='hidden' name='upload_nm' value='"+this.upload_nm+"'/>"+ -->
<!-- 		"<input type='hidden' name='upload_sz' value='"+this.upload_sz+"'/>"+ -->
<!-- 		this.upload_nm+ -->
<!-- 		"<div class=\"checker\"><span class=\"\">"+ -->
<!-- 		"<input class=\"uniform_on\" type=\"checkbox\" name=\"file_del_yn\" value=\""+iCnt+"\">"+ -->
<!-- 		"</span></div>"+ -->
<!-- 		"삭제"+ -->
<!-- 		"</label>"; -->
	<c:if test="${files !=null && fn:length(files)>0 }">
		<c:forEach var="file" items="${files}" varStatus="status">
	<div class="uniform _hwFiles">
		<input type='hidden' name='bdf_no' value="${file.bdf_no }" />
		<input type='hidden' name='upload' value="${file.p_file_nm }"/>
		<input type='hidden' name='upload_nm' value="${file.view_file_nm }"/>
		<input type='hidden' name='upload_sz' value="${file.file_sz }"/>
${file.view_file_nm }
		<div class="checker"><span class="">
		<input class="uniform_on" type="checkbox" name="file_del_yn" value="${status.index }">
		</span></div>
		삭제
		</div>
		</c:forEach>
	</c:if>

								<button id="_btnFileUpload" onclick="addFile();return false;" class="btn btn-primary">추가</button>
							</div>
						</div>
						<div class="form-actions">
							<button onclick="save();return false;" class="btn btn-primary">저장</button>
							<button onclick="location.href='./brdList.do?_=1${_page.prameter }';return false;" class="btn">목록</button>
							<c:if test="${!empty map.bd_no && '' !=map.bd_no }">
							<button onclick="deleteData();return false;" class="btn btn-danger">삭제</button>
							</c:if>
						</div>
					</fieldset>
				</form>

			</div>
<jsp:include page="/WEB-INF/jsp/pmgr/common/comment.jsp" flush="false"/>
		</div>
	</div>
</div>

<jsp:include page="/WEB-INF/jsp/pmgr/common/editor.jsp" flush="false"/>
<jsp:include page="/WEB-INF/jsp/pmgr/common/fileUpload.jsp" flush="false"/>



<script type="text/javascript">
function save(){
	
	if($("#title").val()==''){
		alert("질문을 입력해주세요");
		$("#title").focus();
		return false;
	}

	if(__editor.getContent()==''){
		alert("답변을 입력해주세요");
// 		$("#content1").focus();
		return false;
	}
	if(confirm("저장하시겠습니까?")){
		$("#frmSave").submit();	
	}
}

//삭제
function deleteData(){
	if(confirm("삭제하시겠습니까?\n삭제한 데이터는 복구할수없습니다")){
		
		$("#frmSave").attr("action","./deleteProcess.do");
		$("#frmSave").submit();	
	}
}

//파일업로드 후 콜백
var fileUploadCallback =function (data){
	var fileHtml = "";
	$.each(data.data.filePaths, function (i) {
		var iCnt = $("._hwFiles").length+i;

		fileHtml+="<label class=\"uniform _hwFiles\">"+
		"<input type='hidden' name='bdf_no' value=' '/>"+
		"<input type='hidden' name='upload' value='"+this.upload+"'/>"+
		"<input type='hidden' name='upload_nm' value='"+this.upload_nm+"'/>"+
		"<input type='hidden' name='upload_sz' value='"+this.upload_sz+"'/>"+
		this.upload_nm+
		"<div class=\"checker\"><span class=\"\">"+
		"<input class=\"uniform_on\" type=\"checkbox\" name=\"file_del_yn\" value=\""+iCnt+"\">"+
		"</span></div>"+
		"삭제"+
		"</label>";
	});
	$("#_btnFileUpload").before(fileHtml);
	$(".uniform_on").uniform();
	$(".modalBtn").trigger("click");
};

// 파일추가 
function addFile(){
	$("#btnUploadFile").trigger("click");
}


</script>
<a href="#" data-toggle="tooltip" title="" data-original-title="A much longer tooltip belongs right here to demonstrate the max-width we apply.">연락처</a>